<?php

class OOWP_Element_Article
    extends OOWP_Element
{

    public function __construct(array $args = array( ))
    {
        $input = $this->merge_arguments(array(
            'attributes' => array( ),
            'contents' => array(
                'header' => new OOWP_Element_Header(array(
                    'contents' => array(
                        new OOWP_Element(array(
                            'attributes' => array(
                                'class' => 'entry-title',
                            ),
                            'contents' => array(
                                new OOWP_Atom_PostTitle( ),
                            ),
                            'tag' => 'h1',
                        )),
                        new OOWP_Element_List(array(
                            'attributes' => array(
                                'class' => 'entry-meta',
                            ),
                            'contents' => array(
                                new OOWP_Atom_PostAuthor( ),
                                new OOWP_Atom_PostDate( ),
                            ),
                            'contents_decorator' => 'li',
                        )),
                    ),
                )), // header
                'content' => new OOWP_Element(array(
                    'attributes' => array(
                        'class' => array('entry-content'),
                    ),
                    'contents' => array(
                        new OOWP_Atom_PostContent( ),
                    )
                )), // content
                'footer' => new OOWP_Element_Footer(array(
                    'attributes' => array(
                        'class' => 'entry-meta',
                    ),
                    'contents' => array(
                        new OOWP_Element_List(array(
                            'attributes' => array(
                                'class' => 'entry-meta',
                            ),
                            'contents' => array(
                                new OOWP_Atom_PostCategories( ),
                                new OOWP_Atom_PostTags( ),
                            ),
                            'contents_decorator' => 'li',
                        )),
                    ),
                )), // footer
            ),
            'container_decorator' => null,
            'contents_decorator' => null,
            'void' => false,
            'tag' => 'article',
        ), $args);

        parent::__construct($input);
    }

    /* ACCESSORS */

    protected function getPost( )
    {
        return $this->dict['post'];
    }

    protected function setPost(stdClass $post)
    {
        $this->dict['post'] = $post;
    }

    /* METHODS */

    protected function filter_element_class($class)
    {
        return array_merge($class, get_post_class('', $this->post->ID));
    }

    protected function filter_element_id($id)
    {
        return 'post-' . $this->post->ID;
    }

}
